package com.jp.controller;

import com.jp.entity.Order;
import com.jp.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class OrderController {

    @Autowired
    private OrderService orderService;

    @GetMapping("getOrder")
    public String getOrder(){
        return orderService.getById(1).toString();
    }

    @PostMapping("/addOrder")
    public boolean addOrder(){
        int i = 1/0;
       return orderService.save(new Order().setMoney(100L).setCount(1)
                .setProductId(12222L).setStatus(10).setStatus(1));
    }
}
